package com.norteksoft.struts.web.ec;

import org.apache.commons.lang.StringUtils;
import org.extremecomponents.table.bean.Column;
import org.extremecomponents.table.cell.HeaderCell;
import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.view.html.BuilderConstants;
import org.extremecomponents.util.HtmlBuilder;
public class CustomSelectallHeaderCell extends HeaderCell {
	protected void buildHeaderHtml(HtmlBuilder html, TableModel model,
			   Column column, String headerClass, String sortImage,
			   String sortOrder) {
			  html.td(2);

			  if (StringUtils.isNotEmpty(headerClass)) {
			   html.styleClass(headerClass);
			  }

			  if (StringUtils.isNotEmpty(column.getHeaderStyle())) {
			   html.style(column.getHeaderStyle());
			  }

			  if (StringUtils.isNotEmpty(column.getWidth())) {
			   html.width(column.getWidth());
			  }

			  html.onclick("selectall()");
			  html.onmouseover("this.className='"
			    + BuilderConstants.TABLE_HEADER_SORT_CSS
			    + "';this.style.cursor='pointer'");
			  if (StringUtils.isNotEmpty(headerClass)) {
			   html.onmouseout("this.className='" + headerClass
			     + "';this.style.cursor='default'");
			  } else {
			   html.onmouseout("this.className='"
			     + BuilderConstants.TABLE_HEADER_CSS
			     + "';this.style.cursor='default'");
			  }
			  html.close();

			  html.append(column.getTitle());

			  html.tdEnd();
			 }


}
